// entity
package model

const (
	success    string = "success"
	fail       string = "fail"
	illegal    string = "illegal_req" //userId和token校验不通过的情况
	illegalMsg string = "用户请求合法性未通过"
)

type Result struct {
	Status  string
	Message string
	Object  interface{}
}
type Grid struct {
	Total int
	Data  interface{}
}

func Success(msg string) Result {
	return Result{Status: success, Message: msg}
}

func SuccessObject(msg string, object interface{}) Result {
	return Result{Status: success, Message: msg, Object: object}
}

func SuccessGrid(total int, data interface{}) Result {
	return Result{Status: success, Message: "操作成功", Object: Grid{total, data}}
}

func Fail(msg string) Result {
	//logger.Error(msg)
	return Result{Status: fail, Message: msg}
}

func FailCustomer(msg string, object interface{}) Result {
	return Result{Status: fail, Message: msg, Object: object}
}

func Illegal(msg string) Result {
	return Result{Status: illegal, Message: msg}
}

func IllegalDefault() Result {
	return Result{Status: illegal, Message: illegalMsg}
}

/*
type MyTokenClaims struct {
	User entity.Users
	Dept entity.Departments
	jwt.StandardClaims
}
*/
